package com.hk.service;

import com.hk.commons.utils.IPUtil;
import com.hk.commons.vo.OperationLogDTO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

/**
 * 日志操作类
 * @author Evan
 * @date 2017/12/12
 */
@Service
public class OperationLogService {
    private Logger log = LoggerFactory.getLogger(OperationLogService.class);

    private RestTemplate restTemplate = new RestTemplate();

    @Value("${webServer.baseUrl}")
    private String webUrl;

    /**
     * 新增操作日志记录
     * @param log
     */
    public void addLog(OperationLogDTO log){
        String url = webUrl+"/api/backend/operationLogging";
        restTemplate.postForObject(url,log,String.class);
    }
}
